<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.io.*,java.util.Locale"%>
<%@ page import="javax.servlet.*,javax.servlet.http.* "%>
<%@ page import="java.text.DateFormat,java.util.Date"%>
<%@ page import="java.text.NumberFormat,java.util.Date"%>
<%
	//获取客户端本地化信息
	Locale locale = request.getLocale();
	String language = locale.getLanguage();
	String country = locale.getCountry();
%>




<html>
<head>
<title>Detecting Locale</title>
</head>
<body>
	<center>
		<h1>Detecting Locale</h1>
	</center>
	<p align="center">
		<%
			out.println("Language : " + language + "<br />");
			out.println("Country  : " + country + "<br />");
		%>
	</p>

	<%
		String title1 = "本地日期";
		//Get the client's Locale
		String date = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.SHORT, locale).format(new Date());
	%>
	<h1>
		<%
			out.print(title1);
		%>
	</h1>

	<div align="center">
		<p>
			Local Date:
			<%
			out.print(date);
		%>
		</p>
	</div>

	<%
		String title2 = "区域特定货币";
		NumberFormat nft = NumberFormat.getCurrencyInstance(locale);
		String formattedCurr = nft.format(1000000);
	%>
	<h1>
		<%
			out.print(title2);
		%>
	</h1>

	<div align="center">
		<p>
			Formatted Currency:
			<%
			out.print(formattedCurr);
		%>
		</p>
	</div>



	<%
		String title3 = "本地特定百分比";
		nft = NumberFormat.getPercentInstance(locale);
		String formattedPerc = nft.format(0.51);
	%>
	<h1>
		<%
			out.print(title3);
		%>
	</h1>

	<div align="center">
		<p>
			Formatted Percentage:
			<%
			out.print(formattedPerc);
		%>
		</p>
	</div>
</body>
</html>